package expert.dao;


import javax.annotation.Resource;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.transaction.annotation.Transactional;

import com.chlitina.hq.modules.expert.dao.ProductCategoryDao;
import com.chlitina.hq.modules.expert.dao.ProductDao;
import com.chlitina.hq.modules.expert.entity.Product;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = "classpath:applicationContext.xml")
@Transactional
public class ProductDaoTest{
	@Resource
    private ProductDao productDao;
	@Resource
    private ProductCategoryDao productCategoryDao;
	
    @Test 
    public void saveTest() {
    	Product p = new Product();
    	p.setProductCategory(productCategoryDao.findOne((long) 1));
    	p.setCode("ww");
    	p.setName("sss");
    	p.setSpec("dss");
    	p.setRetail_price(12);
    	p.setStatus(0);
    	productDao.save(p);
    	
    	System.out.print(p.getName());
    	
    }
}
